package flc.ast.adapter;

import android.graphics.Color;
import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.stark.pmu.bean.FilterItem;

import flc.ast.R;
import flc.ast.bean.PicTurnBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class PicTurnAdapter extends StkProviderMultiAdapter<PicTurnBean> {

    public PicTurnAdapter() {
        addItemProvider(new StkSingleSpanProvider(87));
        addItemProvider(new PicTurnProvider());
    }

    private class PicTurnProvider extends BaseItemProvider<PicTurnBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_pic_turn;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, PicTurnBean bean) {
            baseViewHolder.setText(R.id.tvPicTurnItemItemName,bean.getName());
            if (bean.isSelect()) {
                baseViewHolder.setImageResource(R.id.ivPicTurnItemImg, bean.getSelectImg());
                baseViewHolder.setTextColor(R.id.tvPicTurnItemItemName, Color.parseColor("#FFFFFFFF"));
            } else {
                baseViewHolder.setImageResource(R.id.ivPicTurnItemImg, bean.getImg());
                baseViewHolder.setTextColor(R.id.tvPicTurnItemItemName, Color.parseColor("#FF8C8C8C"));
            }
        }
    }

}
